<?php

class Content extends CI_Controller {

    private $data;

    function __construct() {
        parent::__construct();
        $this->load->model("admin_form_model");
    }

    function index() {
        $this->commonContentLoader();
        $this->load->view("admin/template.php", $this->data);
    }

    function article($op = "add"){
        switch($op){
            case "manage": break;
            default :
                if($this->input->post("submit"))
                    print_r($_POST);
                $this->commonContentLoader();
                $this->data["mainContent"] = "articleInsertingForm";
                $this->load->view("admin/template.php", $this->data);
                break;
        }
    }

    private function iconMenu() {
        load_lang_file('icons');
        $items = array(
            array(
                'href' => current_url().'/article/add',
                'title' => $this->lang->line('write_a_new_article'),
                'img' => '8_48x48.png',
                'span_title' => $this->lang->line('new_article')
            ),
            array(
                'href' => '',
                'title' => $this->lang->line('manage_existing_articles'),
                'img' => '27_48x48.png',
                'span_title' =>$this->lang->line('manage_articles')
            )
        );
        return $items;
    }
    /*
    #Description:
     * Some methods in controller works with the same page layout
     * this method will do stuff for all of them. $this->data["mainContent"]
     * are being set to default, so after calling this method, it should be set
     * by your needs
     *
    #Params:
    */
    private function commonContentLoader(){
        $this->data["iconMenuItems"] = $this->iconMenu();
        $this->data["iconMenu"] = $this->load->view("admin/iconMenu.php", $this->data, true);
    }
}

?>